package com.model;

public class Game {

	private int[] itsThrows = new int[21];
	private int itsCurrentThrow = 0;
	private int itScore = 0;

	public int score() {
		return itScore;
	}

	public void add(int pins) {
		itsThrows[itsCurrentThrow++] = pins;
		itScore += pins;
	}

	public int scoreForFrame(int theFrame) {
		int score = 0;
		int ball = 0;
		for (int currentFrame = 0; currentFrame < theFrame; currentFrame++) {
			//score += itsThrows[ball++] + itsThrows[ball++];
			int firstThrow = itsThrows[ball++];
			int secondThrow = itsThrows[ball++];
			score += firstThrow + secondThrow;
		}
		return score;
	}
}
